﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace JqueryNet.FormControl.FormWebControl
{
    public class JRadioButtonList : JWebControl
    {
        RadioButtonList radioButtonList;
        public JRadioButtonList(RadioButtonList radioButtonList)
            : base(radioButtonList)
        {
            this.radioButtonList = radioButtonList;
        }

        public override void Val()
        {
            Value = radioButtonList.SelectedValue;
        }

        public override void Val(string value)
        {
            foreach (ListItem item in radioButtonList.Items)
            {
                if (item.Value == value)
                {
                    item.Selected = true;
                }
            }
        }
    }
}
